#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project : gtmsAutoTestProject 
@File    : printer_ip_use_interface.py
@IDE     : PyCharm 
@Author  : Mario
@Date    : 2022/5/7 16:38 
@Describe: 获取IP对应打印机信息接口
"""
from fastapi import APIRouter
from FastApi.dto.baseResponseDto import BaseResponseDtoModel
from FastApi.server.middle.setup.printer.printer_ip_use_server import printer_ip_use
from FastApi.dto.middle.setupDto.printer.printer_ip_use_dto import PrinterIpUseDtoModel
from Comm.logUtils.logControl import LogHandler

logger = LogHandler().get_logger()
printerIpUse_router = APIRouter()
response_model = BaseResponseDtoModel()


@printerIpUse_router.post("/ip/printer/info", name="获取IP对应打印机信息")
async def printerIpUse(payload: PrinterIpUseDtoModel):
    logger.info('请求参数:[{}]'.format(payload))
    response_data = printer_ip_use(payload.IP)
    response_model.return_dict['data'] = response_data
    logger.info('接口响应:[{}]'.format(response_model.return_dict))
    return response_model.return_dict
